# CUDA Makefile by Pascal Grosset
# OS: Linux/Max OSX for cuda 2.3
# Date: Jan 29 2010


# Compilation tools and exe
EXEC = cuExe
CC = g++
NVCC = /usr/local/cuda-5.0/bin/nvcc


# Compile options
CFLAGS = -c -Wall
NVCFLAGS = --shared --compiler-options -fPIC

# Lib and include
CUDA_LIB=/usr/local/cuda/lib64
CUDA_INCLUDE=/usr/local/cuda/include
CURRENT_LIB=.

FLAGS = -I$(CUDA_INCLUDE) -L$(CURRENT_LIB) -lmyCuda -L$(CUDA_LIB) -lcuda -lcudart -lm 


all: graphDriver.o libmyCuda.so
	$(CC) graphDriver.o libmyCuda.so  $(FLAGS) -o $(EXEC)  #Linux
	
debug: graphDriver.o libDebugMyCuda.so
	$(CC) graphDriver.o  $(FLAGS) -o $(EXEC)  				# Linux


graphDriver.o: graphDriver.cpp graphColoring.h
	$(CC) $(CFLAGS) -I$(CUDA_INCLUDE) graphDriver.cpp

libmyCuda.so: graphColoring.h graphColoring.cu
	$(NVCC) $(NVCFLAGS) graphColoring.cu -o libmyCuda.so

libDebugMyCuda.so: graphColoring.h graphColoring.cu
	$(NVCC) -deviceemu $(NVCFLAGS) graphColoring.cu -o libmyCuda.so		# -deviceemu for emulation mode



clean:
	rm -rf *.o *.so  *~ $(EXEC)
	clear





